﻿using Bogus;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MaterialDesignDemo
{
    public class Person
    {
        public string Name { get; set; }
        public int Age { get; set; }
        public string Address { get; set; }

        public int ID { get; set; }

        //规则
        private static readonly Faker<Person> personFaker = new Faker<Person>()
            .RuleFor(x=>x.ID,x=>x.IndexFaker)
            .RuleFor(x => x.Name, x => x.Person.FullName)
            .RuleFor(x => x.Age, x => x.Random.Int(20, 30))
            .RuleFor(x => x.Address, x => x.Person.Address.Street);
        /// <summary>
        /// 生成一个
        /// </summary>
        /// <returns></returns>
        public static Person FakeOne()=>personFaker.Generate();
        /// <summary>
        /// 生成多个
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        public static IEnumerable<Person> FakeMany(int count)=>personFaker.Generate(count);
            
    }

}
